package com.inspur.gs.sbssdl.gzgl.advancedshare.advancedshare.front.xjgzfxjform_frm.voactions;

import com.inspur.edp.bff.api.manager.context.QueryContext;
import com.inspur.edp.bff.spi.action.query.BeforeQueryAction;
import com.inspur.edp.cef.entity.condition.EntityFilter;
import com.inspur.edp.cef.entity.condition.FilterCondition;

import java.util.ArrayList;

public class beforeQueryVOAction extends BeforeQueryAction {

    public beforeQueryVOAction(QueryContext context) {
        super(context);
    }

    @Override
    public void execute() {
        String lbbh = (String) this.getContext().getVariableData().getValue("lbbhMap");

        if (lbbh != null && !lbbh.isEmpty()) {
            //定义filter
            EntityFilter filter = getQueryContext().getFilter();

            ArrayList<FilterCondition> filterList = new ArrayList<>(FilterCondition.builder()
                    .orLikeStartWith("gzlxid_lbbh", lbbh)
                    .build());
            filter.addFilterConditions(filterList);
        }
    }
}
